import 'package:cjybase/base/base_page_state.dart';
import 'package:cjybase/util/event.dart';
import 'package:cjybase/widget/cjy_listview.dart';
import 'package:cjybase_example/page/page_manage.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'package:pull_to_refresh/pull_to_refresh.dart';

abstract class ListPageState extends BasePageState<ListPage> {
  /// 必须持有一个list集合
  List<String> dataList = [];

  @override
  Widget build(BuildContext context);

  String htmlData = "";
  CjyListViewState mState;

  eventListen(Event event) {}

  onState(CjyListViewState state) {
    mState = state;
  }

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  List<String> items = ["1", "2", "3", "4", "5", "6", "7", "8"];
  CjyController cjyController = CjyController();

  void onRefresh() async {
    // monitor network fetch
    await Future.delayed(Duration(milliseconds: 1000));
    // if failed,use refreshFailed()
    cjyController.onFinishRefresh(['123', '1231']);
  }

  void onLoading() async {
    // monitor network fetch
    await Future.delayed(Duration(milliseconds: 1000));
    // if failed,use loadFailed(),if no data return,use LoadNodata()

    cjyController.onFinishLoading(['123', '1231', '1231']);
  }
}
